<?
require("config.php");

$location_status .= " | Edit";

$show_backnav = "category_menu";

$menuname = NULL;

$menutarget = NULL;

if (NULL!=$action){

	$dir = "$table/";

	myUpload($Logo,$Logo_name,$dir);

	if ($Logo_name == null) $Logo_name = $bk_Logo;

	if ($remove_Logo=="ture") $Logo_name=NULL;


   $field = array(
	"code", 
	"name", 
	"logo", 
	);


   $content = array(
	$Code,
	$Name,
	$Logo_name,
	);

   $expression = "id = $id";

   myUpdate($table,$field,$content,$expression);


   header("location:" . $rela_path . "share/msg.php?v=11");

}else{
	$Query = "select * from $table where id = $id";
	$r = myQuery($Query);

	if (!$r)header("location:" . $rela_path . "share/msg.php?v=9002");
	$Code = $r[0][1];
	$Name = $r[0][2];
	$Logo = $r[0][3];

}

require($rela_path . "inc/header.php");

?>
<form action="" method="post" enctype="multipart/form-data" name="form1">
<table width="95%" border="0" align="center">
  <tr> 
    <td align="right">&nbsp; </td>
  </tr>
  <tr> 
    <td><p><br>
        </p>
        <table>
          <tr> 
            <td class="tdheader">Code :</td>
            <td> <input type="text" class="text" name="Code" size="40" value=<?print($Code)?>> 
              <br> 
              <!--hidden field-->
              <input name="action" type="hidden" value="edit"> 
			  <input name="id" type="hidden" value="<?print($id)?>"> 
			  <input name="bk_Logo" type="hidden" value="<?print($Logo)?>"> 
            </td>
          </tr>
          <tr> 
            <td class="tdheader">Name :</td>
            <td><input type="text" class="text" name="Name" size="40" value="<?print($Name)?>"></td>
          </tr>
          <tr> 
            <td class="tdheader">Logo :</td>
            <td><?loadImage($Logo,$rela_path . $PIC_DIR . "$table/")?>
			<?removeImage($Logo,"remove_Logo")?>
			<input name="Logo" type="File" class="text" size="40"></td>
          </tr>
          <tr> 
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td><input type="image" src="../../images/bt_cancel.gif" onClick="Redirect('category_menu.php',1);return false;"> <input type="image" src="../../images/bt_save.gif">
            </td>
          </tr>
        </table>
        <p><br>
          <br>
          <br>
          <br>
          <br>
        </p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp; </p></td>
  </tr>
</table>
</form>
<?
require($rela_path . "inc/footer.php");
?>
